<div id="content" class="tag">
    <h1>
    <span id="tag" class="tag">
        <a class="name" href="/tag/<?=$data->tag->info->tag?>"><?=$data->tag->info->tag?></a>
        <?if(MEMBER):?><a class="add" href="javascript:addTag('<?=$data->tag->info->ID?>');">+</a><?endif;?>
    </span>
    </h1>
    <div id="shares">
    <?
    if($data->tag->share){
        $i =$data->tag->share;
        include 'apps/'.APP.'/template/_share_item.html';
        }
    ?>
    </div>
    <div class="clear"></div>
</div>
<div id="aside">
    <h2><span><?=_('Created by')?></span></h2>
    <div id="creator">
    <?
        $p = $data->tag->info->creator;
        include 'apps/profile/template/mini.html';
    ?>
    <a class="creatorName" href="/profile/<?=$p->ID?>" title="<?=$p->fullname?>"><?=$p->fullname?></a>
    <span><?=common::timediff($data->tag->info->date);?></span>
    <div class="clear"></div>
    </div><br/>
    <h2><span><?=_('Added Persons')?></span></h2>
    <div id="users">
    <?
        foreach($data->tag->users as $p)
            include 'apps/profile/template/mini.html';
    ?>
    </div>
</div>
<?if(MEMBER):?>
<script type="text/javascript">
    function _complete(r){
        $('<div>').html(tool.jsonDecode(r)).hide().prependTo('#shares').slideDown();
        $('#post').val('').focus();
        $('#submit').removeAttr('disabled');
        $('#loader').css('display','none');
    }
    function  getMore(r){
        tool.post({
            'url':'/json<?=PREFIX.'/'.APP.'/'.CMD?>',
            'data':'CID=<?=PARAMS?>&earlier=1',
            onComplete:function(r){
                $('#earlier').html(tool.jsonDecode(r.message));
            }
        });
    }
    tool.form(false,false,true);
    function addTag (ID){
        $('#result').empty();
        tool.post({'url':'/json/tag/add','data':('ID='+ID),'onComplete':function(r){
           if(r.code == 200){
                //location.href = location.href;
            } else tool.result(r.code,r.status,r.message,r.fields,r.redirect,r.debug);
        }});
    }
    function comment (ID){
        var c = $('#commenttext'+ID).val();
        if(c){
            $('#commenttext'+ID).attr('disabled','disabled').addClass('disabled');
            tool.post({'url':'/json/tag/comment',
                'data':'ID='+ID+'&comment='+c,
                'onComplete':function(r){
                    if(r.code == 200){
                        $('#commenttext'+ID)
                        .removeClass('disabled').removeAttr('disabled').empty();
                        $('<div>').html(r.message)
                        .hide().appendTo('#comments'+ID)
                        .fadeIn();
                    } else tool.result(r.code,r.status,r.message,r.fields,r.redirect,r.debug);
                }});
        }
    }
</script>
<?endif;?>